﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteWithControlAccess.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="ProjetoComperio.DataLayer.Entities" %>
<%@ Import Namespace="MvcContrib" %>
<%@ Import Namespace="MvcContrib.UI.Grid" %>
<%@ Import Namespace="MvcContrib.UI.Grid.ActionSyntax" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Busca de conteúdos
    </h2>
    <form id="formSearch" method="post" action="Search">
    Buscar por:
    <table>
        <tr>
            <td>
                <select id="ContributionType" name="ContributionType">
                    <option value="Project">Projeto </option>
                    <option value="Event">Evento </option>
                    <option value="Publication">Publicação </option>
                </select>
            </td>
            <td>
                <input type="text" id="SearchText" name="SearchText" />
            </td>
            <td>
                <input type="submit" class="Button" value="Buscar!" />
            </td>
        </tr>
    </table>
    </form>
    <br />
    <div class="Grid">
        <%= Html.Grid(ViewData["SearchResults"] as IQueryable<Contribution>).Columns(
           column => 
           {  
                column.For(x => x.Title).Named("Título");
                column.For(x => x.Description).Named("Descrição"); 
                column.For(x => x.RegisterDate.ToString("dd/MM/yyyy HH:mm")).Named("Data de Cadastro");

                column.For(x => "<a href='../" +  ViewData["ContributionType"] + "/Visualize/" + URLEncrypt.EncryptToString(x.ContributionID.ToString()) + "'>" +
             "<img height='25px' width='25px' src='/App_Themes/img/view.png' title='Visualizar' />").DoNotEncode();
               
           }).Attributes(Style =>  "width:100%").Empty("Não há resultados.")
        %>
    </div>
    <br />
</asp:Content>
